<?php
/************************FoxPHP威客系统************************/
/*                                                            */
/*  FoxPHP.Com (C)2006-2016 FoxPHP Inc.                       */
/*  This is NOT a freeware, use is subject to license terms   */
/*  FoxPHP威客系统是商业软件,使用于商业用途请购买授权         */
/*  V3.0 2016.3                                               */
/*  foxphp@aliyun.com                                         */
/*  http://www.foxphp.com                                     */
/*                                                            */
/**************************************************************/

namespace Admin\Model;
use Think\Model;

class ConfigModel extends AdminModel {
	
	function UpdateConfig($post=array()){
		if(!empty($post)){
			foreach($post as $key=>$value){
				if(preg_match("/^[a-zA-Z0-9_]+$/is",$key)){
					//$value=trim(htmlspecialchars($value,ENT_QUOTES,C('S_CHARSET')));
					if($value=='on'){
						$value=1;
					}
					
					if($key=='about' || $key=='contact' || $key=='service'){
						$upload=new \Upload\Model\FileModel();
						$upload->UseFile();
					}
					$this->token(false)->where(" name_foxphp='$key' ")->save(array('value_foxphp'=>$value));
				}
			}
			return true;
		}
		return false;
	}
}

?>